//
//  KLMyMagazineCollectionViewCell.m
//  Koala
//
//  Created by 超八机 on 14/11/23.
//  Copyright (c) 2014年 Anonymous. All rights reserved.
//

#import "KLMyMagazineCollectionViewCell.h"
@interface KLMyMagazineCollectionViewCell()
@property (weak, nonatomic) IBOutlet UIButton *myMagazineEdit;
@property (weak, nonatomic) IBOutlet UIImageView *myMagazineCover;
@property (weak, nonatomic) IBOutlet UIButton *myMagazineAdd;
@property (weak, nonatomic) IBOutlet UIImageView *coverBoder;

@end

@implementation KLMyMagazineCollectionViewCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        
        // 初始化时加载collectionCell.xib文件
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"KLMyMagazineCollectionViewCell" owner:self options:nil];
        
        // 如果路径不存在，return nil
        if (arrayOfViews.count < 1)
        {
            return nil;
        }
        
        // 如果xib中view不属于UICollectionViewCell类，return nil
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]])
        {
            return nil;
        }
        // 加载nib
        self = [arrayOfViews objectAtIndex:0];
        [self.myMagazineEdit setHidden:YES];
        [self.myMagazineAdd setHidden:YES];
        
        [self.myMagazineAdd setBackgroundImage:[UIImage imageNamed:@"MyCenterAdd_N"] forState:UIControlStateNormal];
        [self.myMagazineAdd setBackgroundImage:[UIImage imageNamed:@"MyCenterAdd_P"] forState:UIControlStateHighlighted];
    }
    return self;
}

- (void)setCoverBoderShow:(BOOL)show
{
    [self.myMagazineCover setHidden:!show];
    [self.coverBoder setHidden:!show];
}

- (void)setAddButtonShow:(BOOL)show
{
    [self.myMagazineAdd setHidden:!show];
}

- (void)setMagazine:(UIImage *)cover
{
    [_myMagazineCover setImage:cover];
}

- (void)setEditButtonShow:(BOOL)show
{
    [self.myMagazineEdit setHidden:!show];
}

- (void)awakeFromNib {
    // Initialization code
}

@end
